﻿/*
* Copyright (C) 2020 ~ 2024 chaigec All Rights Reserved.
*
* Author:     chaigec <chaigec@163.com>
* Maintainer: chaigec <chaigec@163.com>

 * Use of this source code is governed by MIT license that can be found in the
 * LICENSE file in the root of the source tree. All contributing project authors
 * may be found in the AUTHORS file in the root of the source tree.
*/

#include "MkPsUtil.h"


MkCodecType CMkPsUtil::PsCodecToMkCodecType(const MkPsStreamType& PsCodec)
{
    MkCodecType MkStreamType = MkCodecUnknown;
    switch (PsCodec) {
    case PsStreamAac:
        MkStreamType = MkCodecAac;
        break;
    case PsStreamH264:
        MkStreamType = MkCodecH264;
        break;
    case PsStreamH265:
        MkStreamType = MkCodecH265;
        break;
    case PsStreamMpeg4:
        MkStreamType = MkCodecMpeg4;
        break;
    case PsStreamULaw:
        MkStreamType = MkCodecG711u;
        break;
    case PsStreamALaw:
        MkStreamType = MkCodecG711a;
        break;
    default:
        break;
    }
    return MkStreamType;
}

MkPsStreamType CMkPsUtil::MkCodecTypeToPsCodec(const MkCodecType& Codec)
{
    MkPsStreamType PsStreamType = PsStreamReserved;
    switch (Codec) {
    case MkCodecAac:
        PsStreamType = PsStreamAac;
        break;
    case MkCodecH264:
        PsStreamType = PsStreamH264;
        break;
    case MkCodecH265:
        PsStreamType = PsStreamH265;
        break;
    case MkCodecMpeg4:
        PsStreamType = PsStreamMpeg4;
        break;
    case MkCodecG711u:
        PsStreamType = PsStreamULaw;
        break;
    case MkCodecG711a:
        PsStreamType = PsStreamALaw;
        break;
    default:
        break;
    }
    return PsStreamType;
}
